function [z, px] = findRelation(pos, match)
B = 64;
B1 = floor(B / 2);
m = length(match);
q = size(pos{1}, 2);
d = zeros(m, q);
for i = 1:m
    p1 = pos{match{i}(1)};
    p2 = pos{match{i}(2)};
    d(i,:) = abs(p1 - p2) / B1;
end
mx = max(d(:,1));
my = max(d(:,3));
z = zeros(mx + 1, my + 1);
for i = 1:m
    z(d(i,1)+1, d(i,3)+1) = z(d(i,1)+1, d(i, 3)+1) + 1;
end

p = max(max(z));
[a, b] = find(z == p);
px = zeros(1,m);
for i = 1:m
    px(i) = (d(i,1)+1 == a(1) && d(i,3)+1 == b(1));
    if px(i)
        dp = pos{match{i}(1)};
        dq = pos{match{i}(2)};
        fprintf(1, '%d, %d -> %d, %d\n',dp(1),dp(3),dq(1), dq(3));
    end
end
end
